<div class="form-inline">
    <p>
        <input name="id" id="appendedInputButton" class="span1" type="text" placeholder="Number">&nbsp;
        <input name="busca" id="appendedInputButton" class="span3" type="text" placeholder="Name">&nbsp;
        <?php 
        $estilo = "style='width:200px;'";
        include "mod/combo/pai_id.php";
        echo "&nbsp;&nbsp;";
        include "mod/combo/aer_id.php";
        echo "&nbsp;&nbsp;";
        $estilo = "style='width:300px;'";
        include "mod/combo/ati_id.php"; 
        ?>
        <input name="data" id="appendedInputButton" class="span2" type="text" placeholder="Date" onfocus="showCalendarControl(this);">
        <input type="submit" name="btnbusca" value="Search" class="btn" >
    </p>
</div>

<table class="table table-striped table-bordered table-hover">

    <tr>
        <th width="90" height="40">Action</th>
        <th width="40">Nº</th>
        <th width="250">Nation</th>
        <th width="150">Headquarter</th>
        <th width="150">Type of Aircraft</th>
        <th>Activity</th>
        <th width="30">Qty.</th>
        <th width="250">Details</th>
        <th width="80">Date</th>
        <th width="80">Status</th>
    </tr>

    <?php
    $sql = "SELECT * FROM logistica 
    INNER JOIN pais ON pais.pai_id=logistica.pai_id
    INNER JOIN aeronave ON aeronave.aer_id=logistica.aer_id
    INNER JOIN atividade ON atividade.ati_id=logistica.ati_id
    LEFT JOIN cliente ON cliente.cli_id=logistica.cli_id
    LEFT JOIN posto ON posto.pos_id=cliente.pos_id
    LEFT JOIN sede ON sede.sed_id=logistica.sed_id
   $onde ORDER BY logistica.log_id DESC";
    $res = sql($sql);
    $i=0;
    while($linha = mysql_fetch_array($res)) {
    ?>

    <tr>
        <td height="40">
            <?php if ($_SESSION['per_id'] != 2){ ?>
            <p><input name="excluir[]" type="checkbox" value="<?=$linha['log_id'];?>"/><i class="icon-trash"></i> Excluir</p>
            <p><a href="?pag=logistica_alt&log_id=<?=$linha['log_id'];?>"><i class="icon-pencil"></i> Editar</a></p>
            <?php } ?>
            <p><a href="#detalhe<?=$i;?>" data-toggle="modal"><i class="icon-zoom-out"></i> Visualizar</a></p>
            <?php include "mod/detalhe/logisticaapoio.php"; ?>
        </td>
        <td><big><strong><?php echo $linha['log_id'];?></strong></big></td>
        <td>
            <?php 
            echo "<p>{$linha['pai_nome']}</p>";
            echo "<p>{$linha['cli_code']} - {$linha['pos_nome']} {$linha['cli_nome']}</p>";
            ?>
        </td>
        <td><?php echo $linha['sed_nome'];?></td>
        <td><?php echo $linha['aer_nome'];?></td>
        <td><?php echo "{$linha['ati_nome']} {$linha['ati_modelo']}";?></td>
        <td><?php echo $linha['log_qtd'];?></td>
        <td>
            <?php 
            echo "<p>Service Time: {$linha['log_localtime']} Z</p>";
            echo "<p>Time of Dept: {$linha['log_timedep']} Z</p>";
            echo "<p>{$linha['log_appron']}<p>";
            echo "<p>".nl2br($linha['log_msg'])."</p>";
            ?>
        </td>
        <td><?php echo todatabr($linha['log_data']);?></td>
        <td>
        <?php
        $sql_status = "SELECT log_sta_nome,log_sta_cor FROM logisticastatus 
					INNER JOIN logistica ON logistica.log_sta_id=logisticastatus.log_sta_id 
					WHERE logistica.log_id='{$linha['log_id']}'";
        $res_status = sql($sql_status);
        $linha_status = mysql_fetch_array($res_status);
        echo "<span style='color:#{$linha_status['log_sta_cor']};font-weight: bold;font-size:110%;'>{$linha_status['log_sta_nome']}</span>";
        ?>
        </td>
    </tr>

    <?
    $i++;
    } 
    ?>
</table>